import { type RouteRecordRaw, createWebHashHistory, createRouter } from 'vue-router'
import Screen from '@/views/screen/index.vue'
import event from '@/api/eventEmitter'
import { ElMessageBox } from 'element-plus'

const routes: RouteRecordRaw[] = [
    {
        path: "/",
        redirect: "/screen"
    },
    {
        path: "/screen",
        component: Screen
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

event.on("API:INVALID", () => {
    ElMessageBox.alert('参数错误', "提示")
})

event.on("API:SESSION_EXPIRED", () => {
    ElMessageBox.alert('登录过期', "提示")
})

export default router